home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / BORL_TIP / TI1000 / TI1188.ASC < prev    next >
Text File  |  1992-10-30  |  5KB  |  199 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.   PRODUCT  :  Borland Pascal/Turbo Pascal           NUMBER  :  1188
  9.   VERSION  :  7.0
  10.        OS  :  ALL
  11.      DATE  :  October 30, 1992                         PAGE  :  1/3
  12.  
  13.     TITLE  :  Creating Protected Mode Apps with Borland Pascal
  14.  
  15.  
  16.  
  17.  
  18.  
  19.   o Benefits of Protected Mode Programming
  20.  
  21.        Borland Pascal with Objects allows you to create DOS
  22.   protected mode applications.
  23.        This means that your programs no longer have to be
  24.   constricted by the long-standing 640 k memory limitation. This
  25.   barrier has now disappeared entirely with our protected mode
  26.   target that allows you to create programs that use up to 16meg of
  27.   code and data.
  28.        You only need to throw a single switch inside the IDE
  29.   (integrated development environment) in order to produce a
  30.   protected mode application. In most circumstances there is no
  31.   need to change your code at all.
  32.        Consider the following program, which reports on the
  33.   available memory:
  34.  
  35.        program MemSize;
  36.  
  37.        begin
  38.          WriteLn(MemAvail);
  39.        end.
  40.  
  41.   If compiled in real mode,  this program will probably report that
  42.   you have between 300,000 and 600,000 bytes of memory available.
  43.   If you open the Compile menu, select Target, and switch from Real
  44.   Mode to Protected Mode code generation, then this program will
  45.   report a figure near the total amount of RAM available on your
  46.   current system.
  47.        If you use the command line compiler, called BPC.EXE, then
  48.   it is only necessary to add "/cp" to the command line in order to
  49.   compile a protected mode app. For instance, to compile the
  50.   program listed above in real mode, one would type:
  51.  
  52.        bpc MemSize
  53.  
  54.   To recompile this same application in protected mode, one would
  55.   type:
  56.  
  57.        bpc/cp MemSize
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.   PRODUCT  :  Borland Pascal/Turbo Pascal           NUMBER  :  1188
  75.   VERSION  :  7.0
  76.        OS  :  ALL
  77.      DATE  :  October 30, 1992                         PAGE  :  2/3
  78.  
  79.     TITLE  :  Creating Protected Mode Apps with Borland Pascal
  80.  
  81.  
  82.  
  83.  
  84.   As an unofficial test case, these two programs were run on a
  85.   system with 12 megs of memory available. In the first case
  86.   MemSize reported 574,144 bytes of memory available, but when
  87.   compiled in protected mode, it reported 9,118,992 bytes of memory
  88.   available. This is a difference of over 8 million bytes.
  89.  
  90.  
  91.   o Differences between Real and Protected Mode programming
  92.  
  93.        Although most Pascal programs written under TP60 will
  94.   recompile unchanged as protected mode apps, developers should be
  95.   aware of the way memory is addressed in protected mode. Real mode
  96.   DOS addresses typically include a segment and offset which
  97.   reference an actual location in memory. But under Intel's
  98.   protected mode memory scheme, the segment portion of an address
  99.   is replaced with something called a selector.
  100.        Selectors are not real memory addresses but rather indexes
  101.   into a descriptor table. This table is maintained by the
  102.   operating system and cannot normally be accessed directly by a
  103.   programmer. This means that programs which directly reference
  104.   real mode memory addresses will have to be adjusted before they
  105.   will run correctly in protected mode.
  106.        Fortunately, Intel has provided programmers with a DOS
  107.   Protected Mode Interface (DPMI) specification, which forms a
  108.   gateway between protected mode and real mode. Borland's new
  109.   protected mode DOS extender is DPMI compliant, so this interface
  110.   is available to experienced programmers who want to address real
  111.   mode memory directly. As a result, Borland Pascal protected mode
  112.   apps have almost unlimited access to real mode.
  113.        Your protected mode applications will also run inside a
  114.   Windows DOS box. This is possible because Windows itself runs in
  115.   protected mode and is somewhat DPMI compliant.
  116.        There are no royalties involved in using this new DOS
  117.   extender technology, but BP.EXE, the new Pascal IDE, requires at
  118.   least a 286 machine with two megs of memory to run. If you can
  119.   meet these requirements then the world of protected mode
  120.   programming is now available to you at the flip of a switch.
  121.        For more information as to the internals of the DOS extender
  122.   technology, Borland has made available the Open Architecture
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.   PRODUCT  :  Borland Pascal/Turbo Pascal           NUMBER  :  1188
  141.   VERSION  :  7.0
  142.        OS  :  ALL
  143.      DATE  :  October 30, 1992                         PAGE  :  3/3
  144.  
  145.     TITLE  :  Creating Protected Mode Apps with Borland Pascal
  146.  
  147.  
  148.  
  149.  
  150.   Handbook which goes in to some detail about this new and exciting
  151.   area of programming.
  152.  
  153.   DISCLAIMER: You have the right to use this technical information
  154.   subject to the terms of the No-Nonsense License Statement that
  155.   you received with the Borland product to which this information
  156.   pertains.
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.